package com.konsung.bean;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;
import org.greenrobot.greendao.annotation.Unique;

import java.util.List;
import org.greenrobot.greendao.DaoException;
import com.konsung.greendaoUtil.DaoSession;
import com.konsung.greendaoUtil.MeasureDataBeanDao;
import com.konsung.greendaoUtil.PatientBeanDao;

/**
 * 病人信息类
 */
@Entity //默认已类名作为数据库文件名称
public class PatientBean {
    @Id(autoincrement = true)
    private Long id;
    private String name;
    private String num = ""; //编号
    @Unique
    private String idcard = "";
    private String idByServer;
    private String orgId;
    private String address;
    private String waist; // 腰围
    private String hipline; // 臀围
    private int sex = 0; //性别 1男 2女
    private int age = 0;
    private int blood = 0;
    private int patientType = 0; // 居民类型 成人 小儿 婴幼儿
    private String contact; // 居民联系方式
    private float height = 0f;
    private float weight = 0f;
    private Long birthday;

    private Long addDate = System.currentTimeMillis(); //居民添加日期
    private Long crimeMeasureDate; //当前居民最近的测量时间
    private String iconPath; //居民身份证头像路径

    private boolean isFileCreat = false;  //是否建档
    private boolean isOtherNetSuccess = false;  //是否查询建档请求成功
    private boolean isUploadAll = false; //居民用户是否已经上传所有测量数据

    private String bmpStr = ""; //头像名称
    private String headBmpStr = ""; //头像字符串

    @ToMany(referencedJoinProperty = "patientId")
    private List<MeasureDataBean> measureDataBeans;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 1766472073)
    private transient PatientBeanDao myDao;
    
    @Generated(hash = 1887147383)
    public PatientBean(Long id, String name, String num, String idcard,
            String idByServer, String orgId, String address, String waist,
            String hipline, int sex, int age, int blood, int patientType,
            String contact, float height, float weight, Long birthday, Long addDate,
            Long crimeMeasureDate, String iconPath, boolean isFileCreat,
            boolean isOtherNetSuccess, boolean isUploadAll, String bmpStr,
            String headBmpStr) {
        this.id = id;
        this.name = name;
        this.num = num;
        this.idcard = idcard;
        this.idByServer = idByServer;
        this.orgId = orgId;
        this.address = address;
        this.waist = waist;
        this.hipline = hipline;
        this.sex = sex;
        this.age = age;
        this.blood = blood;
        this.patientType = patientType;
        this.contact = contact;
        this.height = height;
        this.weight = weight;
        this.birthday = birthday;
        this.addDate = addDate;
        this.crimeMeasureDate = crimeMeasureDate;
        this.iconPath = iconPath;
        this.isFileCreat = isFileCreat;
        this.isOtherNetSuccess = isOtherNetSuccess;
        this.isUploadAll = isUploadAll;
        this.bmpStr = bmpStr;
        this.headBmpStr = headBmpStr;
    }

    @Generated(hash = 200742366)
    public PatientBean() {
    }

    public boolean isFileCreat() {
        return isFileCreat;
    }

    public void setFileCreat(boolean fileCreat) {
        isFileCreat = fileCreat;
    }

    public boolean isOtherNetSuccess() {
        return isOtherNetSuccess;
    }

    public void setOtherNetSuccess(boolean otherNetSuccess) {
        isOtherNetSuccess = otherNetSuccess;
    }



    /**
     * 获取id的值
     *
     * @return id id值
     */
    public Long getId() {
        return id;
    }

    /**
     * 设置id的值
     *
     * @param id id值
     */
    public void setId(long id) {
        this.id = id;
    }

    /**
     * 获取name的值
     *
     * @return name name值
     */
    public String getName() {
        return name;
    }

    /**
     * 设置name的值
     *
     * @param name name值
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * 获取num的值
     *
     * @return num num值
     */
    public String getNum() {
        return num;
    }

    /**
     * 设置num的值
     *
     * @param num num值
     */
    public void setNum(String num) {
        this.num = num;
    }

    /**
     * 获取idCard的值
     *
     * @return idcard idCard值
     */
    public String getIdcard() {
        return idcard;
    }

    /**
     * 设置idCard的值
     *
     * @param idcard idCard值
     */
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }

    /**
     * 获取idByServer的值
     *
     * @return idByServer idByServer值
     */
    public String getIdByServer() {
        return idByServer;
    }

    /**
     * 设置idByServer的值
     *
     * @param idByServer idByServer值
     */
    public void setIdByServer(String idByServer) {
        this.idByServer = idByServer;
    }

    /**
     * 获取orgId的值
     *
     * @return orgId orgId值
     */
    public String getOrgId() {
        return orgId;
    }

    /**
     * 设置orgId的值
     *
     * @param orgId orgId值
     */
    public void setOrgId(String orgId) {
        this.orgId = orgId;
    }

    /**
     * 获取address的值
     *
     * @return address address值
     */
    public String getAddress() {
        return address;
    }

    /**
     * 设置address的值
     *
     * @param address address值
     */
    public void setAddress(String address) {
        this.address = address;
    }

    /**
     * 获取waist的值
     *
     * @return waist waist值
     */
    public String getWaist() {
        return waist;
    }

    /**
     * 设置waist的值
     *
     * @param waist waist值
     */
    public void setWaist(String waist) {
        this.waist = waist;
    }

    /**
     * 获取hipline的值
     *
     * @return hipline hipline值
     */
    public String getHipline() {
        return hipline;
    }

    /**
     * 设置hipline的值
     *
     * @param hipline hipline值
     */
    public void setHipline(String hipline) {
        this.hipline = hipline;
    }

    /**
     * 获取sex的值
     *
     * @return sex sex值
     */
    public int getSex() {
        return sex;
    }

    /**
     * 设置sex的值
     *
     * @param sex sex值
     */
    public void setSex(int sex) {
        this.sex = sex;
    }

    /**
     * 获取age的值
     *
     * @return age age值
     */
    public int getAge() {
        return age;
    }

    /**
     * 设置age的值
     *
     * @param age age值
     */
    public void setAge(int age) {
        this.age = age;
    }

    /**
     * 获取blood的值
     *
     * @return blood blood值
     */
    public int getBlood() {
        return blood;
    }

    /**
     * 设置blood的值
     *
     * @param blood blood值
     */
    public void setBlood(int blood) {
        this.blood = blood;
    }

    /**
     * 获取patientType的值
     *
     * @return patientType patientType值
     */
    public int getPatientType() {
        return patientType;
    }

    /**
     * 设置patientType的值
     *
     * @param patientType patientType值
     */
    public void setPatientType(int patientType) {
        this.patientType = patientType;
    }

    /**
     * 获取contact的值
     *
     * @return contact contact值
     */
    public String getContact() {
        return contact;
    }

    /**
     * 设置contact的值
     *
     * @param contact contact值
     */
    public void setContact(String contact) {
        this.contact = contact;
    }

    /**
     * 获取height的值
     *
     * @return height height值
     */
    public float getHeight() {
        return height;
    }

    /**
     * 设置height的值
     *
     * @param height height值
     */
    public void setHeight(float height) {
        this.height = height;
    }

    /**
     * 获取weight的值
     *
     * @return weight weight值
     */
    public float getWeight() {
        return weight;
    }

    /**
     * 设置weight的值
     *
     * @param weight weight值
     */
    public void setWeight(float weight) {
        this.weight = weight;
    }

    /**
     * 获取birthday的值
     *
     * @return birthday birthday值
     */
    public Long getBirthday() {

        return birthday;
    }

    /**
     * 设置birthday的值
     *
     * @param birthday birthday值
     */
    public void setBirthday(Long birthday) {
        this.birthday = birthday;
    }

    /**
     * 获取addDate的值
     *
     * @return addDate addDate值
     */
    public Long getAddDate() {
        return addDate;
    }

    /**
     * 设置addDate的值
     *
     * @param addDate addDate值
     */
    public void setAddDate(Long addDate) {
        this.addDate = addDate;
    }

    /**
     * 获取crimeMeasureDate的值
     *
     * @return crimeMeasureDate crimeMeasureDate值
     */
    public Long getCrimeMeasureDate() {
        return crimeMeasureDate;
    }

    /**
     * 设置crimeMeasureDate的值
     *
     * @param crimeMeasureDate crimeMeasureDate值
     */
    public void setCrimeMeasureDate(Long crimeMeasureDate) {
        this.crimeMeasureDate = crimeMeasureDate;
    }

    /**
     * 获取iconPath的值
     *
     * @return iconPath iconPath值
     */
    public String getIconPath() {
        return iconPath;
    }

    /**
     * 设置iconPath的值
     *
     * @param iconPath iconPath值
     */
    public void setIconPath(String iconPath) {
        this.iconPath = iconPath;
    }

    /**
     * 设置id
     * @param id id
     */
    public void setId(Long id) {
        this.id = id;
    }

    public boolean getIsFileCreat() {
        return this.isFileCreat;
    }

    public void setIsFileCreat(boolean isFileCreat) {
        this.isFileCreat = isFileCreat;
    }

    public boolean getIsOtherNetSuccess() {
        return this.isOtherNetSuccess;
    }

    public void setIsOtherNetSuccess(boolean isOtherNetSuccess) {
        this.isOtherNetSuccess = isOtherNetSuccess;
    }

    public boolean getIsUploadAll() {
        return this.isUploadAll;
    }

    public void setIsUploadAll(boolean isUploadAll) {
        this.isUploadAll = isUploadAll;
    }

    public String getBmpStr() {
        return this.bmpStr;
    }

    public void setBmpStr(String bmpStr) {
        this.bmpStr = bmpStr;
    }

    public String getHeadBmpStr() {
        return this.headBmpStr;
    }

    public void setHeadBmpStr(String headBmpStr) {
        this.headBmpStr = headBmpStr;
    }

    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 1546201724)
    public List<MeasureDataBean> getMeasureDataBeans() {
        if (measureDataBeans == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            MeasureDataBeanDao targetDao = daoSession.getMeasureDataBeanDao();
            List<MeasureDataBean> measureDataBeansNew = targetDao
                    ._queryPatientBean_MeasureDataBeans(id);
            synchronized (this) {
                if (measureDataBeans == null) {
                    measureDataBeans = measureDataBeansNew;
                }
            }
        }
        return measureDataBeans;
    }

    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1560674763)
    public synchronized void resetMeasureDataBeans() {
        measureDataBeans = null;
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }

    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }

    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1644017270)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getPatientBeanDao() : null;
    }
}